import Vue from 'vue'
import Router from 'vue-router'
import store from '../store/index.js'
import Home from '../page/Home'
import Account from '../page/Account'
import Detailed from '../page/account/detailed'
Vue.use(Router)

const router = new Router({
	mode: 'history',
	routes: [{
			path: '/',
			name: '/',
			component: Home
		},
		{
			path: '/Account',
			name: 'Account',
			component: Account
		},
		{
			path: '/Home',
			name: 'Home',
			component: Home
		},
		{
			path: '/detailed',
			name: 'detailed',
			component: Detailed
		}
	]
})

router.afterEach(route => {
	var txt = route.path.slice(-5);
	if(!(txt == ".html" || route.path == '/home' || route.path == '/account' || route.path == '/')) {
		store.state.isshow.navBarShow = false;
		console.log(store.state.isshow.navBarShow)
	} else {
		store.state.isshow.navBarShow = true;
		console.log(store.state.isshow.navBarShow)
	}
})

export default router